(function () {
    var b = function () {
            var f, e, d  ;
            if (document.compatMode === "CSS1Compat") {
                f = document.documentElement.clientHeight;
                e = document.documentElement.clientWidth;
				if ( !document.body)   d= document.documentElement.scrollTop;
				else d= document.documentElement.scrollTop == 0 ? document.body.scrollTop : document.documentElement.scrollTop;
            } else {
                f = document.body.clientHeight;   //chrome
                e = document.body.clientWidth;
				d=document.body.scrollTop;
            }
            if (window.innerHeight) {
                f = window.innerHeight;
            }
            return {
                wH: f,
                wW: e,
                sT: d
            };
        };
    var c = function () {
            var d = function (f) {
                    if (b().sT >= (1* b().wH)) {
                        if (f !== "scroll") {
                            $(document).scrollLeft(0);
                        }
                        if (b().wW > 1200) {
                            var e = $("#pop_top").outerWidth(true);
                            $("#pop_top").css("right", Math.round((b().wW - 1000) / 2 - e) + "px");
							if ( $.browser.msie && $.browser.version=="6.0") { 
								$("#pop_top").css("position", "absolute");
								//alert("scrollTop  "+b().sT);
								//alert("document.documentElement.clientHeight  "+document.documentElement.clientHeight);
								//alert("document.body.clientHeight  "+document.body.clientHeight);
								//alert("b().wH  "+b().wH);
								var a=b().sT+b().wH-120;
								$("#pop_top").css("top",( a>document.body.clientHeight? document.body.clientHeight : a )+"px");
							}
                        } else {
							if ( $.browser.msie && $.browser.version=="6.0") { 
								$("#pop_top").css("position", "absolute");
								var a=b().sT+b().wH-120;
								$("#pop_top").css("top",( a>document.body.clientHeight? document.body.clientHeight : a )+"px");
							}
                            $("#pop_top").css("right", 0);
                        }
                        $("#pop_top").css("display", "block");
                        $("#pop_top").click(function () {
                            scrollTo(0, 0);
                        });
                    } else { 
                        $("#pop_top").css("display", "none");
                    }
                };
            $(window).bind("resize", function () {
                d();
            });
            $(window).bind("scroll", function () {
                d("scroll");
            });
            d();
        };
   
    c();
})();